package com.mz.mattress.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mz.mattress.api.entity.CouponGoods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CouponGoodsMapper extends BaseMapper<CouponGoods> {

    @Update("update mz_coupon_goods set deleted=1 where coupon_id=#{couponId}")
    int deleteByCouponId(@Param("couponId") Integer couponId);

    @Select("select goods_id from mz_coupon_goods where coupon_id=#{couponId} and deleted=0")
    List<Integer> selectByCouponId(@Param("couponId") Integer couponId);

}
